home *** CD-ROM | disk | FTP | other *** search
/ Whiteline: Alpha / Whiteline Alpha.iso / tools / prtfolio / menu.bas < prev    next >
Encoding:
BASIC Source File  |  1994-09-22  |  2.2 KB  |  70 lines

  1. ' This program will provide the user with a
  2. ' menu front end for the PBASIC demo programs
  3. '
  4. ' Since we are going to save screens, set string size to 350
  5. ssize=350
  6.  
  7. ' Declare our main and auxilary menu arrays
  8. dim m$(8), a$(8)
  9.  
  10. ' Here is the matrix of Programs
  11. ' The first elements are the options of the main menu, as well as
  12. ' the titles for the auxilary menus
  13. ' The data lines need to be number from 1, with the last data line
  14. ' Containing only the null "" string
  15. '
  16. ' Then the entire list of programs for the auxilary menu
  17. ' They are followed by the null "" string
  18. '
  19. '      Title            Programs
  20. 1 data "Recreation",    "ETCH","QCHESS","REDDOG","REV","TIC","VADERS",""
  21. 2 data "Music",        "BACH1","BACH2","BDAY","BETH2","KRIEGER","PETER1",""
  22. 3 data "Graphics",    "RUNMAN","2CURVE","CIRCLE","PGDEMO","WKSPLOT","BAR","CHART",""
  23. 4 data "Time",        "WTIME","100DAY","ADDTIM","DAYS",""
  24. 5 data "Other",        "AREACD","SIEVE","TEST47","GATE40","TERMINAL",""
  25. 6 data ""
  26.  
  27.  
  28. cline=0        ' Current Line
  29. select=0    ' Selected Item
  30. cls
  31. mcnt=0        ' Main Menu Count
  32. done=false                           
  33. repeat
  34.     restore mcnt+1        ' Point to data line
  35.     read m$(mcnt)        ' Read Title
  36.     if m$(mcnt)<>"" then mcnt=mcnt+1 else done=true
  37. until done
  38.  
  39. ' Display main menu
  40. 10 mc=menu(1,1,mcnt,cline,select,mcnt+1,"PBASIC Menu",m$(0),m$(1),m$(2),m$(3),m$(4),m$(5),m$(6),m$(7))
  41. select = mc % 256        ' Determine the item selected
  42. cline = mc \ 256        ' Determine the top line so we can go back
  43. if select=-1 then cls:end    ' Hit <ESC>? Exit...
  44. restore select+1        ' Otherwise Point to selected data line
  45. read title$            ' Read Title
  46. ocnt=0
  47. done=false
  48. repeat
  49.     read a$(ocnt)        ' Read the Programs
  50.     if a$(ocnt)<>"" then ocnt=ocnt+1 else done=true
  51. until done
  52.  
  53. scrsave s$            ' Save the current screen
  54. ndis=ocnt
  55. if ocnt>6 then ndis=6
  56. mc=menu(1,10,ndis,0,0,ocnt+1,title$,a$(0),a$(1),a$(2),a$(3),a$(4),a$(5),a$(6))
  57. pick = mc % 256            ' Determine which Program
  58. if pick=-1 then scrload s$:goto 10    ' <ESC>?  Restore Screen, Main Menu
  59. cls                
  60. run a$(pick)                    ' Run the Program
  61. '
  62. '
  63. '    At the end of each program on the list, install this line:
  64. '
  65. '    IF ISRUN THEN RUN "MENU" ELSE END
  66. '
  67. '    This will return each program to this program, if it was started
  68. '    from this program
  69. '
  70. ə